package com.lei.convercet;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName DateConverter
 * @Description TODO
 * @Author Admin
 * @Date 2021/8/31 17:36
 * @Version 1.0
 */
public class DateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String s) {
        SimpleDateFormat format=new SimpleDateFormat("yyyy/MM/dd");
        try {
            Date date=format.parse(s);
            return date;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
